BUILD		:= build

COBJS		+= main.o
COBJS		+= list.o



#tools
CROSS_COMPILE	:= arm-linux-
CC				:= gcc #$(CROSS_COMPILE)gcc
LD				:= ld #$(CROSS_COMPILE)ld
OBJCOPY			:= objcopy #$(CROSS_COMPILE)objcopy
OBJDUMP			:= objdump #$(CROSS_COMPILE)objdump

#flags
CFLAGS			+= -Wall
CFLAGS			+= -I./
LDFLAGS			+= -Tmap.lds
LDFLAGS			+= -Ttext 0xD0020010
#LDFLAGS			+= -Ttext 0xD0024000
#LDFLAGS			+= -Ttext 0x0


#routine
all:$(BUILD)
$(BUILD) : $(COBJS)
	$(LD) -o $@ $^


%.o:%.S
	$(CC) $(CFLAGS) -c -o $@ $<
	
%.o:%.c
	$(CC) $(CFLAGS) -c -o $@ $<

clean:
	rm -f $(TARGET) $(BUILD) *.o *.TMP